/**
 * 获取滚动的头部距离和左边距离
 * scroll().top scroll().left
 * @returns {*}
 */
 function scroll() {
    if(window.pageYOffset !== null){
        return {
            top: window.pageYOffset,
            left: window.pageXOffset
        }
    }else if(document.compatMode === "CSS1Compat"){ // W3C
        return {
            top: document.documentElement.scrollTop,
            left: document.documentElement.scrollLeft
        }
    }else{
        return {
            top: document.body.scrollTop,
            left: document.body.scrollLeft
        }
    }
    return{
        top: 0,
        left : 0
    }
}
function client(){
    if(window.innerWidth !== null){
        return {
            width: window.innerWidth,
            height: window.innerHeight
        }
    }else if(document.compatMode === "CSS1Compat"){ // W3C
        return {
            width: document.documentElement.clientWidth,
            height: document.documentElement.clientHeight
        }
    }else{
        return {
            width: document.body.clientWidth,
            height: document.body.lientHeight
        }
    } 
    return{
        width: 0,
        height: 0
    } 
}
function $(id){
    return typeof id === 'string' ? document.getElementById(id) : null; 
}